home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / MacOS / QuickDraw™ 3D 1.0.6F4 SDK / Samples / SampleCode / Geometry Samples / Txtr_Math.h < prev   
Encoding:
C/C++ Source or Header  |  1995-09-20  |  3.0 KB  |  89 lines  |  [TEXT/MPCC]

  1. /*
  2.  *    Txtr_Math.h
  3.  *
  4.  *     09/06/94    RDD        Copied from EscherMath.h.
  5.  *     09/20/95    RDD        Cleanup.
  6.  */
  7.  
  8. #ifndef _HTxtr_Math
  9. #define _HTxtr_Math
  10.  
  11. /* This is a workaround… */
  12. #ifdef kQ3RealZero
  13.     #undef kQ3RealZero
  14.     #define kQ3RealZero            ((float)1.19209290e-07)            
  15. #endif
  16.  
  17.  
  18. /******************************************************************************
  19.  **                                                                             **
  20.  **                            Miscellaneous Functions                             **
  21.  **                                                                             **
  22.  *****************************************************************************/
  23.  
  24. #define uMath_DegreesToRadians(x)    ((x) *  kQ3Pi / 180.0)
  25. #define uMath_RadiansToDegrees(x)    ((x) * 180.0 / kQ3Pi)
  26.  
  27. #define uMath_Ceil(x)            ((float)ceil((double)(x)))
  28. #define uMath_Floor(x)            ((float)floor((double)(x)))
  29.  
  30. #define uMath_Min(x,y)            ((x) <= (y) ? (x) : (y))
  31. #define uMath_Max(x,y)            ((x) >= (y) ? (x) : (y))
  32.  
  33. #define uMath_Fabs(x)            ((float)fabs((double)(x)))
  34. #define uMath_Abs(x)            ((long)fabs((double)(x)))
  35.  
  36. #define uMath_Pow(x,y)            ((float)pow((double)(x),(double)(y)))
  37.  
  38. #define uMath_Sqrt(x)            ((float)sqrt((double)(x)))
  39.  
  40. #define uMath_Fmod(x,y)            ((float)fmod((double)(x),(double)(y)))
  41.  
  42. #define uMath_Frexp(x,nPtr)        ((float)frexp((double)(x),(int *)(nPtr)))
  43.  
  44. #define uMath_Ldexp(x,n)        ((float)ldexp((double)(x),(int)(n)))
  45.  
  46. #define uMath_Log10(x)            ((float)log10((double)(x)))    
  47.  
  48. #define uMath_Modf(x,nPtr)        ((float)modf((double)(x),(double *)(nPtr)))
  49.  
  50. #define uMath_Exp(x)            ((float)exp((double)(x)))
  51.  
  52. #define uMath_Log(x)            ((float)log((double)(x)))
  53.         
  54.  
  55. /******************************************************************************
  56.  **                                                                             **
  57.  **                            Trigonometric Functions                             **
  58.  **                                                                             **
  59.  *****************************************************************************/
  60.  
  61. #define uMath_Sin(x)            ((float)sin((double)(x)))
  62. #define uMath_Cos(x)            ((float)cos((double)(x)))
  63. #define uMath_Tan(x)            ((float)tan((double)(x)))
  64.  
  65. #define uMath_Asin(x)            ((float)asin((double)(x)))
  66. #define uMath_Acos(x)            ((float)acos((double)(x)))
  67. #define uMath_Atan(x)            ((float)atan((double)(x)))
  68. #define uMath_Atan2(x,y)        ((float)atan2((double)(x),(double)(y)))
  69.  
  70. #define uMath_Sinh(x)            ((float)sinh((double)(x)))
  71. #define uMath_Cosh(x)            ((float)cosh((double)(x)))
  72. #define uMath_Tanh(x)            ((float)tanh((double)(x)))
  73.  
  74. #define uMath_Sin_Deg(x)        ((float)sin((double)Q3Math_DegreesToRadians((x))))
  75. #define uMath_Cos_Deg(x)        ((float)cos((double)Q3Math_DegreesToRadians((x))))
  76. #define uMath_Tan_Deg(x)        ((float)tan((double)Q3Math_DegreesToRadians((x))))
  77.  
  78. #define uMath_Asin_Deg(x)        ((float)Q3Math_RadiansToDegrees(asin((double)(x))))
  79. #define uMath_Acos_Deg(x)        ((float)Q3Math_RadiansToDegrees(acos((double)(x))))
  80. #define uMath_Atan_Deg(x)        ((float)Q3Math_RadiansToDegrees(atan((double)(x))))
  81. #define uMath_Atan2_Deg(x,y)    ((float)Q3Math_RadiansToDegrees(atan2((double)(x),(double)(y))))
  82.  
  83. #define uMath_Sinh_Deg(x)        ((float)sinh((double)Q3Math_DegreesToRadians((x))))
  84. #define uMath_Cosh_Deg(x)        ((float)cosh((double)Q3Math_DegreesToRadians((x))))
  85. #define uMath_Tanh_Deg(x)        ((float)tanh((double)Q3Math_DegreesToRadians((x))))
  86.  
  87.  
  88. #endif /* _HTxtr_Math */
  89.